#!/bin/sh
clear
if [ -n "$1" ]; then
	cd $1
else
	echo "No parameter found!Build failed."
	exit
fi
echo "Building...Please wait."
if [ ! -n "$2" ]; then
	set $1 main.cpp
fi
#echo $2
if [ ! -f "$2" ]; then
	clear
	echo "Cannot find code!Failed to compile."
	exit
fi
g++ $2
clear
if [ -f "./a.out" ]; then
	echo "Running..."
	./a.out
else
	echo "Program not found!Compile error."
	exit
fi
